package io;

import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;

/**
 * CheckFileIsInUse
 *
 * @author nanxin.chen
 * @date 2015/9/29
 */
public class CheckFileIsInUse {
    public static void main(String[] args) throws IOException {
        File dir = new File("dir");
        File[] files = new File[4];
        if (!dir.exists()) {
            dir.mkdir();
        }
        int k=0;
        for (File f : files) {
            f = new File("./dir/test" + (++k) + ".txt");
            if (!f.exists()) {
                f.createNewFile();
            }
        }
        System.out.println(dir.setReadable(false));
        FileUtils.deleteQuietly(dir);
    }
}
